package com.example.controller;

import com.example.entity.Person;
import com.example.service.FeignService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author およそ神
 * @version JDK 1.8
 */
@RestController("/person")
public class FeignController {
    @Autowired
    FeignService feignService;

    @GetMapping("/searchById/{id}")
    public Person get(@PathVariable Integer id){
        return feignService.searchById(id);
    }

    @PostMapping("/addPerson")
    public boolean add(Person person ){
        return feignService.addPerson(person);
    }

    @GetMapping("/searchAll")
    public List<Person> list(){
        return feignService.searchAll();
    }
}
